﻿@model IEnumerable<trangbaocao.Models.Device_StationsAssociateModel>        
<!--Body-->
<div align="center" style="margin-bottom:10px;"><h1>DANH MỤC THIẾT BỊ TRONG TRẠM</h1></div>
<div class="container_12">
    <div class="grid_12">
        <!-- Notification boxes -->
        @if (TempData["msg"] != null)
        {                            
            <span class="notification n-success">@TempData["msg"]</span>
        } 
        @using (Html.BeginForm("FindMove_Device", "Move_Device", FormMethod.Post, new { FindMove_Device = "FindMove_Device", name = "FindMove_Device" }))
        {
            
               @* <div class="bottom-spacing">
                    <label style="width:40%; float:left">Trung tâm:
                        
                    </label>
                    <p style="width:40%"> 
                    Trạm: 
                    @Html.DropDownList("stations_id", Enumerable.Empty<SelectListItem>(), "---Chọn nhà trạm---")  
                    </p>
                    </div>*@
                   <div style="padding-left:5px; margin-bottom:5px; text-align:left; width:40%">
                   <lable style="margin-right:3px">Trung tâm: </lable>
                    @if (ViewBag.trungtam_id != null)
                        {  
                             
                            @Html.DropDownList("main_stations_id", ViewBag.trungtam_id as SelectList, "---Chọn trung tâm---")    
                            
                        }
                    </div>
                    <p style="text-align:left; width:40%;padding-left:5px">
                        <p style="text-align:left; width:40%; float:left; padding-left:5px"> Trạm:&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
                    @Html.DropDownList("stations_id", Enumerable.Empty<SelectListItem>(), "---Chọn nhà trạm---")
                        </p>
                        <input class="submit-green" type="submit" value="Tìm kiếm" style="width:10%; margin-left:-50px"  />                
                    </p>
            <!-- Button --> 
             
        }      
            <!-- Example table -->  
        @using (Html.BeginForm("CheckedAction", "Move_Device", FormMethod.Post, new { id = "CheckedAction", name = "CheckedAction" }))
        {                     
            <div class="module">
                <h2><span>@*Sample table*@</span></h2>                    
               @* <div class="module-table-body">
                    <table id="myTable" class="tablesorter">*@
                    <div class="module-table-body">
                        <div class="scrolling">
                        <div class="data-table" style="width:260%">
                            <table id="myTable" class="tablesorter">
                                <thead>
                                    <tr>
                                        <th style="width:3%">STT</th>
                                        <th style="width:4%">Lịch sử</th>
                                        <th style="width:4%">Chuyển</th>
                                        <th style="width:6%">Mã thiết bị</th>
                                        <th style="width:9%">Tên thiết bị trong trạm </th>
                                        <th style="width:6%">Thiết bị</th>
                                        <th style="width:8%">Loại thiết bị</th>
                                        <th style="width:6%">Hệ thống VT</th>
                                        <th style="width:7%">Nhà trạm</th>  
                                        <th style="width:7%">Trung tâm</th>                                     
                                        <th style="width:5.5%">Số hiệu TB</th>
                                        <th style="width:6%">Ngày lắp đặt</th>
                                        <th style="width:6.5%">Ngày sử dụng</th>
                                        <th style="width:6%">Thông tin TB</th>
                                        <th style="width:7.5%">Nhân viên lắp đặt</th>
                                        <th style="width:5%">Trạng thái</th>
                                        @*<th>Ghi chú</th>*@                                        
                                    </tr>
                                </thead>
                             <tbody>
                        @{int stt = 0;}
                        @foreach (var item in Model)
                        {
                            stt++;
                            <tr>
                                <td class="align-center">@stt</td>
                                <td class="align-center">                                    	
                                    @*<a href="" title=""><img src="../../Content/Body/Images/tick-circle.gif"  width="16" height="16" alt="published" /></a>*@
                                    @*<a href=""><img src="../../Content/Body/Images/balloon.gif" width="16" height="16" alt="comments" /></a>*@
                                    <a href="@Url.Action("Lichsu_Device", "Move_Device", new { device_statios_id = item.id })"  title="Xem lịch sử thiết bị"><img src="@Url.Content("~/Content/Body/Images/Crystal_Clear_file.gif")" width="16" height="16" alt="delete" /></a>&nbsp;&nbsp;&nbsp;
                                </td>
                                <td class="align-center">
                                    <a href="@Url.Action("Dieuchuyen_Device", "Move_Device", new { id = item.id })" title="Điều chuyển thiết bị"><img src="@Url.Content("~/Content/Body/Images/arrow-curve-000-left.gif")"  width="16" height="16" alt="edit" /></a>
                                </td>
                                @*<td class="align-center"><input type="checkbox" name="Items" id="Items[]" value="@item.user_name"/></td>*@
                                
                                
                                <td> @Html.DisplayFor(modelItem => item.ma_he_thong)</td>
                                <td> @Html.DisplayFor(modelItem => item.name)</td>
                                <td> @Html.DisplayFor(modelItem => item.device_name)</td>
                                <td> @Html.DisplayFor(modelItem => item.sort_device_name)</td>
                                <td> @Html.DisplayFor(modelItem => item.main_sort_device_name)</td>
                                <td> @Html.DisplayFor(modelItem => item.stations_name)</td>
                                <td> @Html.DisplayFor(modelItem => item.main_stations_name)</td>
                                <td> @Html.DisplayFor(modelItem => item.so_hieu_tb)</td>
                                <td> @Html.DisplayFor(modelItem => item.ngay_lap_dat)</td>
                                <td> @Html.DisplayFor(modelItem => item.ngay_su_dung)</td>
                                <td> @Html.DisplayFor(modelItem => item.thong_tin_tb)</td>
                                <td> @Html.DisplayFor(modelItem => item.nv_lap_dat)</td>
                                <td> @Html.DisplayFor(modelItem => item.trang_thai_hd)</td>
                                @*<td> @Html.DisplayFor(modelItem => item.ghi_chu)</td> *@                                   
                                
                            </tr>
                        }   
                        </tbody>
                    </table>
                    </div></div>
                    <div class="pager" id="pager">
                        <div>
                        <img class="first" src="@Url.Content("~/Content/Body/Images/arrow-stop-180.gif")"  alt="first"/>
                        <img class="prev" src="@Url.Content("~/Content/Body/Images/arrow-180.gif")" alt="prev"/> 
                        <input type="text" class="pagedisplay input-short align-center"/>
                        <img class="next" src="@Url.Content("~/Content/Body/Images/arrow.gif")" alt="next"/>
                        <img class="last" src="@Url.Content("~/Content/Body/Images/arrow-stop.gif")" alt="last"/>
                        <select class="pagesize input-short align-center">
                            <option value="20" selected="selected">20</option>
                            <option value="30">30</option>
                            <option value="40">40</option>
                        </select>
                        </div>
                    </div>
                    <div style="clear: both"></div>
                </div> <!-- End .module-table-body -->
            </div> <!-- End .module --> 
        }                                                                    
	</div> <!-- End .grid_12 -->            
    <div style="clear:both;"></div>            
</div> <!-- End .container_12 -->
<!----------------------------------------------------------------->
<script type="text/javascript">
    $("#main_stations_id").change(function () {
        $.ajax({
            type: "POST",
            url: '@Url.Action("getStationsJson", "Move_Device")',
            data: { MainStationId: $("#main_stations_id > option:selected").attr("value"), Order: "name" },
            success: function (data) {
                var items = [];
                items.push("<option>---Chọn nhà trạm---</option>");
                $.each(data, function () {
                    items.push("<option value=" + this.Value + ">" + this.Text + "</option>");
                });
                $("#stations_id").html(items.join(' '));
            }
        })
    });
</script>
